package 回溯;
import java.util.List;
import java.util.Deque;
import java.util.ArrayDeque;
import java.util.ArrayList;
public class backTracing {
	public static void main(String []args){
			Deque<Integer> path  = new ArrayDeque<>();
			List<List<Integer>> ans = new ArrayList<>();
			solution(7,path,ans,1);
//			System.out.println(ans);
			for(List<Integer> i : ans) {
				System.out.println(i);
			}
		
		
		
	}
	public static void solution(int n,Deque<Integer> path,List<List<Integer>>
	ans,int index){
		if(path.size() == 6) {
			ans.add(new ArrayList<>(path));
			return ;
		}
		for(int i = index; i <=n ;i++) {
			path.add(i);
			solution(n,path,ans,i+1);
			path.removeLast();
		}
		
	}
}
